using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum E_AttributePropsType
{
    Atk,
    Def,
    ExtraHp,
    Hp,
    MoveSpeed,
}

public class AttributeProps : RewardBase
{
    public E_AttributePropsType type;

    public float increase = 0.2f;
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player")
        {
            //得到玩家脚本
            PlayerObject player = other.GetComponent<PlayerObject>();
            switch (type)
            {
                case E_AttributePropsType.MoveSpeed:
                    player.moveSpeed += player.moveSpeed * increase;
                    break;
                case E_AttributePropsType.Def:
                    player.def += player.def * increase;
                    break;
                case E_AttributePropsType.Atk:
                    player.atk += player.atk * increase;
                    break;
                case E_AttributePropsType.Hp:
                    player.hp += (player.originalmaxHp + player.extraHp) * increase * 2;
                    if (player.hp > player.originalmaxHp + player.extraHp)
                    {
                        player.hp = player.originalmaxHp + player.extraHp;
                    }
                    //更新血条面板
                    GamePanel.Instance.UpadteHPPanel(player.originalmaxHp, player.hp, player.extraHp);
                    break;
                case E_AttributePropsType.ExtraHp:
                    player.extraHp += player.originalmaxHp * increase;
                    //更新血条面板
                    GamePanel.Instance.UpadteHPPanel(player.originalmaxHp, player.hp, player.extraHp);
                    break;
            }
            RewardLifeCycle();
        }
    }
}
